<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Administrator Page</title>
	
		<link rel="stylesheet" href="<c:url value="css/bootstrap.min.css" />"
			type="text/css" />
		<link rel="stylesheet"
			href="<c:url value="font-awesome-4.2.0/css/font-awesome.min.css" />"
			type="text/css" />
		<link rel="stylesheet" href="<c:url value="css/jquery-ui-min.css" />"
			type="text/css" />
		<link rel="stylesheet"
			href="<c:url value="css/jquery.dataTables.css" />" type="text/css" />
		<link rel="stylesheet"
			href="<c:url value="css/style.css" />" type="text/css" />
		<link rel="stylesheet"
			href="<c:url value="css/animate.css" />" type="text/css" />
		<script src="<c:url value="js/jquery/jquery.min.js" />"
			type="text/javascript"></script>
		<script src="<c:url value="js/jquery/jquery-ui.js" />"
			type="text/javascript"></script>
		<script src="<c:url value="js/jquery/jquery.dataTables.js" />"
			type="text/javascript"></script>
		<script>
			$(document).ready(function() {
				$("#mytable").dataTable();
			});
		</script>
	</head>
	<body class="container-fluid">
		<header class="row">
			<div id="logocontainer" class="col-md-2">
				<img src="images/logo.png"/>		
			</div>
			<div class="col-md-10 status-container">
				<h1 class="welcomeMessage">Administrator page</h1>
			</div>
			<div class="bg-trees"></div>
		</header>
		<section class="row">
			<div id="bodycontainer" class="col-md-11">
				<h2 class="headerMessage"><span class="fa fa-random"></span> Transaction History</h2>
				<table id="mytable" class="table table-striped">
					<thead>
						<tr>
							<th>Id</th>
							<th>Date and time</th>
							<th>Sender</th>
							<th>Receiver</th>
							<th>State</th>
							<th>Detail</th>
							<th class="text-center">View details</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach var="transaction" items="${transactionList}">
							<tr>
								<td>${transaction.transactionId}</td>
								<td>${transaction.date}</td>
								<td>${transaction.sendCustomer.firstName} ${transaction.sendCustomer.lastName}</td>
								<td>${transaction.receivedCustomer.firstName} ${transaction.receivedCustomer.lastName}</td>
								<td class="${transaction.transactionState.stateDescription}">${transaction.transactionState.stateDescription}</td>
								<td>${transaction.description}</td>
								<c:choose>
							        <c:when test="${transaction.transactionState.stateDescription == 'pending'}">
							             <td class="text-center"><a href="viewRequestApprove?transactionId=${transaction.transactionId}">View</a></td>
							        </c:when>
							        <c:otherwise>
							             <td class="text-center"><a href="viewTransactionDetail?transactionId=${transaction.transactionId}">View</a></td>
							        </c:otherwise>
							    </c:choose>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
			<%@include file="admin_menu.jsp" %>
		</section>
		<footer>
			cdc_bank@csc.com
		</footer>
	</body>
</html>